Change xenbus_transaction fake pointer into an opaque type.
authorvhanquez@kneesa.uk.xensource.com <vhanquez@kneesa.uk.xensource.com>
Tue, 10 Jan 2006 17:16:30 +0000 (17:16 +0000)
committervhanquez@kneesa.uk.xensource.com <vhanquez@kneesa.uk.xensource.com>
Tue, 10 Jan 2006 17:16:30 +0000 (17:16 +0000)
Signed-off-by: Vincent Hanquez <vincent@xensource.com>
15 files changed:
linux-2.6-xen-sparse/arch/xen/kernel/reboot.c
linux-2.6-xen-sparse/drivers/xen/blkback/xenbus.c
linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c
linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c
linux-2.6-xen-sparse/drivers/xen/tpmback/xenbus.c
linux-2.6-xen-sparse/drivers/xen/tpmfront/tpmfront.c
linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_client.c
linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_dev.c
linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c
linux-2.6-xen-sparse/include/asm-xen/xenbus.h
tools/python/xen/lowlevel/xs/xs.c
tools/xenstore/xenstore_client.c
tools/xenstore/xs.c
tools/xenstore/xs.h
tools/xenstore/xs_test.c

index 644a2c1015b88bd361a34193aca15ba521c53a38..7a14d8b6cdd8119820c5ae69c85814325a9fa4fe 100644 (file)
@@ -290,7 +290,7 @@ static void shutdown_handler(struct xenbus_watch *watch,
                             const char **vec, unsigned int len)
 {
        char *str;
-       struct xenbus_transaction *xbt;
+       xenbus_transaction_t xbt;
        int err;
 
        if (shutting_down != SHUTDOWN_INVALID)
@@ -339,7 +339,7 @@ static void sysrq_handler(struct xenbus_watch *watch, const char **vec,
                          unsigned int len)
 {
        char sysrq_key = '\0';
-       struct xenbus_transaction *xbt;
+       xenbus_transaction_t xbt;
        int err;
 
  again:
index 2b2f40f2e6644f4e7548baf80f9c3c32ae98c38b..c5612ce48b479f81daf4810d3804a6495a858a49 100644 (file)
@@ -302,7 +302,7 @@ static void maybe_connect(struct backend_info *be)
  */
 static void connect(struct backend_info *be)
 {
-       struct xenbus_transaction *xbt;
+       xenbus_transaction_t xbt;
        int err;
        struct xenbus_device *dev = be->dev;
 
index 5bf408a9b8694c5138bb76a3c542b1badbe1c517..9864ef0a637bfa3c803cae3c707916c6f08f5aa6 100644 (file)
@@ -161,7 +161,7 @@ static int talk_to_backend(struct xenbus_device *dev,
                           struct blkfront_info *info)
 {
        const char *message = NULL;
-       struct xenbus_transaction *xbt;
+       xenbus_transaction_t xbt;
        int err;
 
        /* Create shared ring, alloc event channel. */
index 5c3e56335801114479274b3548a2209271bf03b9..86798341f41b89b7311ac0c0cd9e02c896ba0f10 100644 (file)
@@ -260,7 +260,7 @@ static int talk_to_backend(struct xenbus_device *dev,
                           struct netfront_info *info)
 {
        const char *message;
-       struct xenbus_transaction *xbt;
+       xenbus_transaction_t xbt;
        int err;
 
        err = xen_net_read_mac(dev, info->mac);
index b5039adadc9852d23b495e057a2251c4dbc663ab..f93d1c219b1fad359dd132f64ab898b68cf9742b 100644 (file)
@@ -230,7 +230,7 @@ static void maybe_connect(struct backend_info *be)
 
 static void connect(struct backend_info *be)
 {
-       struct xenbus_transaction *xbt;
+       xenbus_transaction_t xbt;
        int err;
        struct xenbus_device *dev = be->dev;
        unsigned long ready = 1;
index 72b1971421db9de1dd96e3da1c9f90ed9eb92c9a..488a17bd6947c66f5224705c3256a40ac171da11 100644 (file)
@@ -271,7 +271,7 @@ static int talk_to_backend(struct xenbus_device *dev,
 {
        const char *message = NULL;
        int err;
-       struct xenbus_transaction *xbt;
+       xenbus_transaction_t xbt;
 
        err = setup_tpmring(dev, info);
        if (err) {
index 385419e134ed3e134b5e8acdd6f17b0a693d17cb..303eab86c4e1eb359baa49fe601cd99055affb1d 100644 (file)
@@ -87,7 +87,7 @@ EXPORT_SYMBOL(xenbus_watch_path2);
 
 
 int xenbus_switch_state(struct xenbus_device *dev,
-                       struct xenbus_transaction *xbt,
+                       xenbus_transaction_t xbt,
                        XenbusState state)
 {
        /* We check whether the state is currently set to the given value, and
index b7a7d892f59e70fb83a039a85018d58c25d597d6..4cfd57c34fba3bbdba641cdcd9a5cf2b0b1a3b82 100644 (file)
@@ -47,7 +47,7 @@
 
 struct xenbus_dev_transaction {
        struct list_head list;
-       struct xenbus_transaction *handle;
+       xenbus_transaction_t handle;
 };
 
 struct xenbus_dev_data {
@@ -147,7 +147,7 @@ static ssize_t xenbus_dev_write(struct file *filp,
                }
 
                if (u->u.msg.type == XS_TRANSACTION_START) {
-                       trans->handle = (struct xenbus_transaction *)
+                       trans->handle = (xenbus_transaction_t)
                                simple_strtoul(reply, NULL, 0);
                        list_add(&trans->list, &u->transactions);
                } else if (u->u.msg.type == XS_TRANSACTION_END) {
index b6435d704043f6656741cee81dc9ae77baf64296..98498dcf97998925a83fd3f6982f58128cddc35a 100644 (file)
@@ -190,7 +190,7 @@ void *xenbus_dev_request_and_reply(struct xsd_sockmsg *msg)
 }
 
 /* Send message to xs, get kmalloc'ed reply.  ERR_PTR() on error. */
-static void *xs_talkv(struct xenbus_transaction *t,
+static void *xs_talkv(xenbus_transaction_t t,
                      enum xsd_sockmsg_type type,
                      const struct kvec *iovec,
                      unsigned int num_vecs,
@@ -242,7 +242,7 @@ static void *xs_talkv(struct xenbus_transaction *t,
 }
 
 /* Simplified version of xs_talkv: single message. */
-static void *xs_single(struct xenbus_transaction *t,
+static void *xs_single(xenbus_transaction_t t,
                       enum xsd_sockmsg_type type,
                       const char *string,
                       unsigned int *len)
@@ -309,7 +309,7 @@ static char **split(char *strings, unsigned int len, unsigned int *num)
        return ret;
 }
 
-char **xenbus_directory(struct xenbus_transaction *t,
+char **xenbus_directory(xenbus_transaction_t t,
                        const char *dir, const char *node, unsigned int *num)
 {
        char *strings, *path;
@@ -329,7 +329,7 @@ char **xenbus_directory(struct xenbus_transaction *t,
 EXPORT_SYMBOL(xenbus_directory);
 
 /* Check if a path exists. Return 1 if it does. */
-int xenbus_exists(struct xenbus_transaction *t,
+int xenbus_exists(xenbus_transaction_t t,
                  const char *dir, const char *node)
 {
        char **d;
@@ -347,7 +347,7 @@ EXPORT_SYMBOL(xenbus_exists);
  * Returns a kmalloced value: call free() on it after use.
  * len indicates length in bytes.
  */
-void *xenbus_read(struct xenbus_transaction *t,
+void *xenbus_read(xenbus_transaction_t t,
                  const char *dir, const char *node, unsigned int *len)
 {
        char *path;
@@ -366,7 +366,7 @@ EXPORT_SYMBOL(xenbus_read);
 /* Write the value of a single file.
  * Returns -err on failure.
  */
-int xenbus_write(struct xenbus_transaction *t,
+int xenbus_write(xenbus_transaction_t t,
                 const char *dir, const char *node, const char *string)
 {
        const char *path;
@@ -389,7 +389,7 @@ int xenbus_write(struct xenbus_transaction *t,
 EXPORT_SYMBOL(xenbus_write);
 
 /* Create a new directory. */
-int xenbus_mkdir(struct xenbus_transaction *t,
+int xenbus_mkdir(xenbus_transaction_t t,
                 const char *dir, const char *node)
 {
        char *path;
@@ -406,7 +406,7 @@ int xenbus_mkdir(struct xenbus_transaction *t,
 EXPORT_SYMBOL(xenbus_mkdir);
 
 /* Destroy a file or directory (directories must be empty). */
-int xenbus_rm(struct xenbus_transaction *t, const char *dir, const char *node)
+int xenbus_rm(xenbus_transaction_t t, const char *dir, const char *node)
 {
        char *path;
        int ret;
@@ -424,7 +424,7 @@ EXPORT_SYMBOL(xenbus_rm);
 /* Start a transaction: changes by others will not be seen during this
  * transaction, and changes will not be visible to others until end.
  */
-struct xenbus_transaction *xenbus_transaction_start(void)
+xenbus_transaction_t xenbus_transaction_start(void)
 {
        char *id_str;
        unsigned long id;
@@ -434,20 +434,20 @@ struct xenbus_transaction *xenbus_transaction_start(void)
        id_str = xs_single(XBT_NULL, XS_TRANSACTION_START, "", NULL);
        if (IS_ERR(id_str)) {
                up_read(&xs_state.suspend_mutex);
-               return (struct xenbus_transaction *)id_str;
+               return (xenbus_transaction_t )id_str;
        }
 
        id = simple_strtoul(id_str, NULL, 0);
        kfree(id_str);
 
-       return (struct xenbus_transaction *)id;
+       return (xenbus_transaction_t) id;
 }
 EXPORT_SYMBOL(xenbus_transaction_start);
 
 /* End a transaction.
  * If abandon is true, transaction is discarded instead of committed.
  */
-int xenbus_transaction_end(struct xenbus_transaction *t, int abort)
+int xenbus_transaction_end(xenbus_transaction_t t, int abort)
 {
        char abortstr[2];
        int err;
@@ -466,7 +466,7 @@ int xenbus_transaction_end(struct xenbus_transaction *t, int abort)
 EXPORT_SYMBOL(xenbus_transaction_end);
 
 /* Single read and scanf: returns -errno or num scanned. */
-int xenbus_scanf(struct xenbus_transaction *t,
+int xenbus_scanf(xenbus_transaction_t t,
                 const char *dir, const char *node, const char *fmt, ...)
 {
        va_list ap;
@@ -489,7 +489,7 @@ int xenbus_scanf(struct xenbus_transaction *t,
 EXPORT_SYMBOL(xenbus_scanf);
 
 /* Single printf and write: returns -errno or 0. */
-int xenbus_printf(struct xenbus_transaction *t,
+int xenbus_printf(xenbus_transaction_t t,
                  const char *dir, const char *node, const char *fmt, ...)
 {
        va_list ap;
@@ -515,7 +515,7 @@ int xenbus_printf(struct xenbus_transaction *t,
 EXPORT_SYMBOL(xenbus_printf);
 
 /* Takes tuples of names, scanf-style args, and void **, NULL terminated. */
-int xenbus_gather(struct xenbus_transaction *t, const char *dir, ...)
+int xenbus_gather(xenbus_transaction_t t, const char *dir, ...)
 {
        va_list ap;
        const char *name;
index c7e3ac783447c2e2cd92ab8a7ca95dcc3371f397..b6339dbc75f5bc85803bbfa2b98a2522531f43eb 100644 (file)
@@ -103,34 +103,35 @@ int xenbus_register_backend(struct xenbus_driver *drv);
 void xenbus_unregister_driver(struct xenbus_driver *drv);
 
 struct xenbus_transaction;
+typedef struct xenbus_transaction *xenbus_transaction_t;
 
-char **xenbus_directory(struct xenbus_transaction *t,
+char **xenbus_directory(xenbus_transaction_t t,
                        const char *dir, const char *node, unsigned int *num);
-void *xenbus_read(struct xenbus_transaction *t,
+void *xenbus_read(xenbus_transaction_t t,
                  const char *dir, const char *node, unsigned int *len);
-int xenbus_write(struct xenbus_transaction *t,
+int xenbus_write(xenbus_transaction_t t,
                 const char *dir, const char *node, const char *string);
-int xenbus_mkdir(struct xenbus_transaction *t,
+int xenbus_mkdir(xenbus_transaction_t t,
                 const char *dir, const char *node);
-int xenbus_exists(struct xenbus_transaction *t,
+int xenbus_exists(xenbus_transaction_t t,
                  const char *dir, const char *node);
-int xenbus_rm(struct xenbus_transaction *t, const char *dir, const char *node);
-struct xenbus_transaction *xenbus_transaction_start(void);
-int xenbus_transaction_end(struct xenbus_transaction *t, int abort);
+int xenbus_rm(xenbus_transaction_t t, const char *dir, const char *node);
+xenbus_transaction_t xenbus_transaction_start(void);
+int xenbus_transaction_end(xenbus_transaction_t t, int abort);
 
 /* Single read and scanf: returns -errno or num scanned if > 0. */
-int xenbus_scanf(struct xenbus_transaction *t,
+int xenbus_scanf(xenbus_transaction_t t,
                 const char *dir, const char *node, const char *fmt, ...)
        __attribute__((format(scanf, 4, 5)));
 
 /* Single printf and write: returns -errno or 0. */
-int xenbus_printf(struct xenbus_transaction *t,
+int xenbus_printf(xenbus_transaction_t t,
                  const char *dir, const char *node, const char *fmt, ...)
        __attribute__((format(printf, 4, 5)));
 
 /* Generic read function: NULL-terminated triples of name,
  * sprintf-style type string, and pointer. Returns 0 or errno.*/
-int xenbus_gather(struct xenbus_transaction *t, const char *dir, ...);
+int xenbus_gather(xenbus_transaction_t t, const char *dir, ...);
 
 /* notifer routines for when the xenstore comes up */
 int register_xenstore_notifier(struct notifier_block *nb);
@@ -196,7 +197,7 @@ int xenbus_watch_path2(struct xenbus_device *dev, const char *path,
  * XenbusStateClosing, and the error will be saved in the store.
  */
 int xenbus_switch_state(struct xenbus_device *dev,
-                       struct xenbus_transaction *xbt,
+                       xenbus_transaction_t xbt,
                        XenbusState new_state);
 
 
index e473a4902bcc46ff28f6265c7dd75971bfa741c1..35c3c0cf6a4f943cc4f0927694bc717e6dd98713 100644 (file)
@@ -66,7 +66,7 @@ static PyObject *none(bool result);
 
 static int parse_transaction_path(XsHandle *self, PyObject *args,
                                   struct xs_handle **xh,
-                                  struct xs_transaction_handle **th,
+                                  xs_transaction_handle *th,
                                   char **path);
 
 
@@ -83,7 +83,7 @@ static int parse_transaction_path(XsHandle *self, PyObject *args,
 static PyObject *xspy_read(XsHandle *self, PyObject *args)
 {
     struct xs_handle *xh;
-    struct xs_transaction_handle *th;
+    xs_transaction_handle th;
     char *path;
 
     char *xsval;
@@ -120,7 +120,7 @@ static PyObject *xspy_write(XsHandle *self, PyObject *args)
 {
     static char *arg_spec = "sss#";
     struct xs_handle *xh = xshandle(self);
-    struct xs_transaction_handle *th;
+    xs_transaction_handle th;
     char *thstr;
     char *path;
     char *data;
@@ -132,7 +132,7 @@ static PyObject *xspy_write(XsHandle *self, PyObject *args)
     if (!PyArg_ParseTuple(args, arg_spec, &thstr, &path, &data, &data_n))
         return NULL;
 
-    th = (struct xs_transaction_handle *)strtoul(thstr, NULL, 16);
+    th = (xs_transaction_handle)strtoul(thstr, NULL, 16);
 
     Py_BEGIN_ALLOW_THREADS
     result = xs_write(xh, th, path, data, data_n);
@@ -155,7 +155,7 @@ static PyObject *xspy_write(XsHandle *self, PyObject *args)
 static PyObject *xspy_ls(XsHandle *self, PyObject *args)
 {
     struct xs_handle *xh;
-    struct xs_transaction_handle *th;
+    xs_transaction_handle th;
     char *path;
 
     char **xsval;
@@ -193,7 +193,7 @@ static PyObject *xspy_ls(XsHandle *self, PyObject *args)
 static PyObject *xspy_mkdir(XsHandle *self, PyObject *args)
 {
     struct xs_handle *xh;
-    struct xs_transaction_handle *th;
+    xs_transaction_handle th;
     char *path;
 
     bool result;
@@ -221,7 +221,7 @@ static PyObject *xspy_mkdir(XsHandle *self, PyObject *args)
 static PyObject *xspy_rm(XsHandle *self, PyObject *args)
 {
     struct xs_handle *xh;
-    struct xs_transaction_handle *th;
+    xs_transaction_handle th;
     char *path;
 
     bool result;
@@ -256,7 +256,7 @@ static PyObject *xspy_get_permissions(XsHandle *self, PyObject *args)
     unsigned int perms_n = 0;
     int i;
 
-    struct xs_transaction_handle *th;
+    xs_transaction_handle th;
     char *thstr;
 
     if (!xh)
@@ -264,7 +264,7 @@ static PyObject *xspy_get_permissions(XsHandle *self, PyObject *args)
     if (!PyArg_ParseTuple(args, arg_spec, &thstr, &path))
         return NULL;
 
-    th = (struct xs_transaction_handle *)strtoul(thstr, NULL, 16);
+    th = (xs_transaction_handle)strtoul(thstr, NULL, 16);
 
     Py_BEGIN_ALLOW_THREADS
     perms = xs_get_permissions(xh, th, path, &perms_n);
@@ -312,7 +312,7 @@ static PyObject *xspy_set_permissions(XsHandle *self, PyObject *args)
     int xsperms_n;
     PyObject *tuple0 = NULL;
 
-    struct xs_transaction_handle *th;
+    xs_transaction_handle th;
     char *thstr;
 
     if (!xh)
@@ -320,7 +320,7 @@ static PyObject *xspy_set_permissions(XsHandle *self, PyObject *args)
     if (!PyArg_ParseTuple(args, "ssO", &thstr, &path, &perms))
         goto exit;
 
-    th = (struct xs_transaction_handle *)strtoul(thstr, NULL, 16);
+    th = (xs_transaction_handle)strtoul(thstr, NULL, 16);
 
     if (!PyList_Check(perms)) {
         PyErr_SetString(PyExc_RuntimeError, "perms must be a list");
@@ -509,7 +509,7 @@ static PyObject *xspy_unwatch(XsHandle *self, PyObject *args)
 static PyObject *xspy_transaction_start(XsHandle *self)
 {
     struct xs_handle *xh = xshandle(self);
-    struct xs_transaction_handle *th;
+    xs_transaction_handle th;
     char thstr[MAX_STRLEN(unsigned long) + 1];
 
     if (!xh)
@@ -547,7 +547,7 @@ static PyObject *xspy_transaction_end(XsHandle *self, PyObject *args,
     struct xs_handle *xh = xshandle(self);
     bool result;
 
-    struct xs_transaction_handle *th;
+    xs_transaction_handle th;
     char *thstr;
 
     if (!xh)
@@ -556,7 +556,7 @@ static PyObject *xspy_transaction_end(XsHandle *self, PyObject *args,
                                      &thstr, &abort))
         return NULL;
 
-    th = (struct xs_transaction_handle *)strtoul(thstr, NULL, 16);
+    th = (xs_transaction_handle)strtoul(thstr, NULL, 16);
 
     Py_BEGIN_ALLOW_THREADS
     result = xs_transaction_end(xh, th, abort);
@@ -727,7 +727,7 @@ static void remove_watch(XsHandle *self, PyObject *token)
  */
 static int parse_transaction_path(XsHandle *self, PyObject *args,
                                   struct xs_handle **xh,
-                                  struct xs_transaction_handle **th,
+                                  xs_transaction_handle *th,
                                   char **path)
 {
     char *thstr;
@@ -740,7 +740,7 @@ static int parse_transaction_path(XsHandle *self, PyObject *args,
     if (!PyArg_ParseTuple(args, "ss", &thstr, path))
         return 0;
 
-    *th = (struct xs_transaction_handle *)strtoul(thstr, NULL, 16);
+    *th = (xs_transaction_handle)strtoul(thstr, NULL, 16);
 
     return 1;
 }
index f8e1f5c893a9eead7ade37f3982c0a1bc76d7ec1..5090499af3d9ceab7ddac5f2099648eab2c65e07 100644 (file)
@@ -66,7 +66,7 @@ usage(const char *progname)
 
 #if defined(CLIENT_rm)
 static int
-do_rm(char *path, struct xs_handle *xsh, struct xs_transaction_handle *xth)
+do_rm(char *path, struct xs_handle *xsh, xs_transaction_handle xth)
 {
     if (xs_rm(xsh, xth, path)) {
         return 0;
@@ -81,7 +81,7 @@ do_rm(char *path, struct xs_handle *xsh, struct xs_transaction_handle *xth)
 
 static int
 perform(int optind, int argc, char **argv, struct xs_handle *xsh,
-        struct xs_transaction_handle *xth, int prefix, int tidy)
+        xs_transaction_handle xth, int prefix, int tidy)
 {
     while (optind < argc) {
 #if defined(CLIENT_read)
@@ -179,7 +179,7 @@ int
 main(int argc, char **argv)
 {
     struct xs_handle *xsh;
-    struct xs_transaction_handle *xth;
+    xs_transaction_handle xth;
     int ret = 0, socket = 0;
     int prefix = 0;
     int tidy = 0;
index b8d9e23e7c9f23e5b77ab18af1b9977906293919..3ecb462ea3014b0456e03b15ddd80a0dc2ae0f56 100644 (file)
@@ -292,7 +292,7 @@ static void *read_reply(
 }
 
 /* Send message to xs, get malloc'ed reply.  NULL and set errno on error. */
-static void *xs_talkv(struct xs_handle *h, struct xs_transaction_handle *t,
+static void *xs_talkv(struct xs_handle *h, xs_transaction_handle t,
                      enum xsd_sockmsg_type type,
                      const struct iovec *iovec,
                      unsigned int num_vecs,
@@ -368,7 +368,7 @@ static void free_no_errno(void *p)
 }
 
 /* Simplified version of xs_talkv: single message. */
-static void *xs_single(struct xs_handle *h, struct xs_transaction_handle *t,
+static void *xs_single(struct xs_handle *h, xs_transaction_handle t,
                       enum xsd_sockmsg_type type,
                       const char *string,
                       unsigned int *len)
@@ -388,7 +388,7 @@ static bool xs_bool(char *reply)
        return true;
 }
 
-char **xs_directory(struct xs_handle *h, struct xs_transaction_handle *t,
+char **xs_directory(struct xs_handle *h, xs_transaction_handle t,
                    const char *path, unsigned int *num)
 {
        char *strings, *p, **ret;
@@ -420,7 +420,7 @@ char **xs_directory(struct xs_handle *h, struct xs_transaction_handle *t,
  * Returns a malloced value: call free() on it after use.
  * len indicates length in bytes, not including the nul.
  */
-void *xs_read(struct xs_handle *h, struct xs_transaction_handle *t,
+void *xs_read(struct xs_handle *h, xs_transaction_handle t,
              const char *path, unsigned int *len)
 {
        return xs_single(h, t, XS_READ, path, len);
@@ -429,7 +429,7 @@ void *xs_read(struct xs_handle *h, struct xs_transaction_handle *t,
 /* Write the value of a single file.
  * Returns false on failure.
  */
-bool xs_write(struct xs_handle *h, struct xs_transaction_handle *t,
+bool xs_write(struct xs_handle *h, xs_transaction_handle t,
              const char *path, const void *data, unsigned int len)
 {
        struct iovec iovec[2];
@@ -446,7 +446,7 @@ bool xs_write(struct xs_handle *h, struct xs_transaction_handle *t,
 /* Create a new directory.
  * Returns false on failure, or success if it already exists.
  */
-bool xs_mkdir(struct xs_handle *h, struct xs_transaction_handle *t,
+bool xs_mkdir(struct xs_handle *h, xs_transaction_handle t,
              const char *path)
 {
        return xs_bool(xs_single(h, t, XS_MKDIR, path, NULL));
@@ -455,7 +455,7 @@ bool xs_mkdir(struct xs_handle *h, struct xs_transaction_handle *t,
 /* Destroy a file or directory (directories must be empty).
  * Returns false on failure, or success if it doesn't exist.
  */
-bool xs_rm(struct xs_handle *h, struct xs_transaction_handle *t,
+bool xs_rm(struct xs_handle *h, xs_transaction_handle t,
           const char *path)
 {
        return xs_bool(xs_single(h, t, XS_RM, path, NULL));
@@ -465,7 +465,7 @@ bool xs_rm(struct xs_handle *h, struct xs_transaction_handle *t,
  * Returns malloced array, or NULL: call free() after use.
  */
 struct xs_permissions *xs_get_permissions(struct xs_handle *h,
-                                         struct xs_transaction_handle *t,
+                                         xs_transaction_handle t,
                                          const char *path, unsigned int *num)
 {
        char *strings;
@@ -499,7 +499,7 @@ struct xs_permissions *xs_get_permissions(struct xs_handle *h,
  * Returns false on failure.
  */
 bool xs_set_permissions(struct xs_handle *h,
-                       struct xs_transaction_handle *t,
+                       xs_transaction_handle t,
                        const char *path,
                        struct xs_permissions *perms,
                        unsigned int num_perms)
@@ -636,7 +636,7 @@ bool xs_unwatch(struct xs_handle *h, const char *path, const char *token)
  * You can only have one transaction at any time.
  * Returns NULL on failure.
  */
-struct xs_transaction_handle *xs_transaction_start(struct xs_handle *h)
+xs_transaction_handle xs_transaction_start(struct xs_handle *h)
 {
        char *id_str;
        unsigned long id;
@@ -648,7 +648,7 @@ struct xs_transaction_handle *xs_transaction_start(struct xs_handle *h)
        id = strtoul(id_str, NULL, 0);
        free(id_str);
 
-       return (struct xs_transaction_handle *)id;
+       return (xs_transaction_handle)id;
 }
 
 /* End a transaction.
@@ -656,7 +656,7 @@ struct xs_transaction_handle *xs_transaction_start(struct xs_handle *h)
  * Returns false on failure, which indicates an error: transactions will
  * not fail spuriously.
  */
-bool xs_transaction_end(struct xs_handle *h, struct xs_transaction_handle *t,
+bool xs_transaction_end(struct xs_handle *h, xs_transaction_handle t,
                        bool abort)
 {
        char abortstr[2];
index 0d0a8c8dd90eee831676f80e90441d7eedb5bae9..173c4bc564486305ed431dacca3088fe6c103894 100644 (file)
@@ -26,6 +26,7 @@
 
 struct xs_handle;
 struct xs_transaction_handle;
+typedef struct xs_transaction_handle * xs_transaction_handle;
 
 /* On failure, these routines set errno. */
 
@@ -47,45 +48,45 @@ void xs_daemon_close(struct xs_handle *);
  * Returns a malloced array: call free() on it after use.
  * Num indicates size.
  */
-char **xs_directory(struct xs_handle *h, struct xs_transaction_handle *t,
+char **xs_directory(struct xs_handle *h, xs_transaction_handle t,
                    const char *path, unsigned int *num);
 
 /* Get the value of a single file, nul terminated.
  * Returns a malloced value: call free() on it after use.
  * len indicates length in bytes, not including terminator.
  */
-void *xs_read(struct xs_handle *h, struct xs_transaction_handle *t,
+void *xs_read(struct xs_handle *h, xs_transaction_handle t,
              const char *path, unsigned int *len);
 
 /* Write the value of a single file.
  * Returns false on failure.
  */
-bool xs_write(struct xs_handle *h, struct xs_transaction_handle *t,
+bool xs_write(struct xs_handle *h, xs_transaction_handle t,
              const char *path, const void *data, unsigned int len);
 
 /* Create a new directory.
  * Returns false on failure, or success if it already exists.
  */
-bool xs_mkdir(struct xs_handle *h, struct xs_transaction_handle *t,
+bool xs_mkdir(struct xs_handle *h, xs_transaction_handle t,
              const char *path);
 
 /* Destroy a file or directory (and children).
  * Returns false on failure, or if it doesn't exist.
  */
-bool xs_rm(struct xs_handle *h, struct xs_transaction_handle *t,
+bool xs_rm(struct xs_handle *h, xs_transaction_handle t,
           const char *path);
 
 /* Get permissions of node (first element is owner, first perms is "other").
  * Returns malloced array, or NULL: call free() after use.
  */
 struct xs_permissions *xs_get_permissions(struct xs_handle *h,
-                                         struct xs_transaction_handle *t,
+                                         xs_transaction_handle t,
                                          const char *path, unsigned int *num);
 
 /* Set permissions of node (must be owner).
  * Returns false on failure.
  */
-bool xs_set_permissions(struct xs_handle *h, struct xs_transaction_handle *t,
+bool xs_set_permissions(struct xs_handle *h, xs_transaction_handle t,
                        const char *path, struct xs_permissions *perms,
                        unsigned int num_perms);
 
@@ -115,14 +116,14 @@ bool xs_unwatch(struct xs_handle *h, const char *path, const char *token);
  * You can only have one transaction at any time.
  * Returns NULL on failure.
  */
-struct xs_transaction_handle *xs_transaction_start(struct xs_handle *h);
+xs_transaction_handle xs_transaction_start(struct xs_handle *h);
 
 /* End a transaction.
  * If abandon is true, transaction is discarded instead of committed.
  * Returns false on failure: if errno == EAGAIN, you have to restart
  * transaction.
  */
-bool xs_transaction_end(struct xs_handle *h, struct xs_transaction_handle *t,
+bool xs_transaction_end(struct xs_handle *h, xs_transaction_handle t,
                        bool abort);
 
 /* Introduce a new domain.
index 09e04a8c62fe0169a53b6dc2225720f442765679..03674bd26e2dc60a91c19799f8a700058caebc3f 100644 (file)
@@ -43,7 +43,7 @@
 #define XSTEST
 
 static struct xs_handle *handles[10] = { NULL };
-static struct xs_transaction_handle *txh[10] = { XBT_NULL };
+static xs_transaction_handle txh[10] = { XBT_NULL };
 
 static unsigned int timeout_ms = 500;
 static bool timeout_suppressed = true;